﻿/*
 *  XTL - XNA Tool Library, a collection with usefull XNA classes
 * 
 *  Copyright (C) 2009 Sebastian Schäfer, Daniel Schiffner
 * 
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; version 2 of the License.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License 
 *  along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace XTL.Models
{
    /// <summary>
    /// Abstract class for a drawable model. Subject to change.
    /// </summary>
    public abstract class DrawableModel
    {
        /// <summary>
        /// Internal parameter for the <see cref="GraphicsDeviceManager"/>
        /// </summary>
        protected GraphicsDeviceManager graphics;
        /// <summary>
        /// Gets/Sets the name of the model
        /// </summary>
        public String Name{get;set;}
        /// <summary>
        /// Gets the <see cref="GraphicsDeviceManager"/> used in this model.
        /// </summary>
        public GraphicsDeviceManager Graphics { get { return graphics; } }
        /// <summary>
        /// Gets/Sets the <see cref="VertexDeclaration"/>.
        /// </summary>
        public VertexDeclaration VertexDeclaration { get; set; }
        /// <summary>
        /// Gets/Sets the indices of the vertices defined in this model.
        /// </summary>
        /// <value>Array of indices</value>
        /// Set is protected.
        public short[] Indices { get; protected set; }
        /// <summary>
        /// Gets/Sets the type of primitives to render.
        /// </summary>
        public PrimitiveType RenderType { get; set; }
        /// <summary>
        /// Gets/Sets the number of primitives to render.
        /// </summary>
        public int PrimitiveCount { get; set; }
        /// <summary>
        /// Gets/Sets the culling mode to use in this model.
        /// </summary>
        public CullMode CullMode { get; set; }

        /// <summary>
        /// Basic constructor.
        /// </summary>
        /// <param name="g">Reference to the used GraphicsDeviceManager</param>
        public DrawableModel(ref GraphicsDeviceManager g)
        {
            CullMode = CullMode.None;
            graphics = g;
            PrimitiveCount = 0;
            RenderType = PrimitiveType.PointList;
            Indices = new short[0] {};
            VertexDeclaration = null;
        }

        /// <summary>
        /// Abstract method to draw a model.
        /// </summary>
        public abstract void Draw();
    }
}
